using System;
using System.Collections.Generic;
using System.Text;

namespace Eve.Data
{
    public class Celestial : EveObject
    {
        private double temperature;
        private string spectralClass;
        private double luminosity;
        private double age;
        private double life;
        private double orbitRadius;
        private double eccentricity;
        private double massDust;
        private double massGas;
        private bool fragmented;
        private double density;
        private double surfaceGravity;
        private double escapeVelocity;
        private double orbitPeriod;
        private double rotationRate;
        private bool locked;
        private double pressure;
        private double radius;
        private double mass;

        public double Temperature
        {
            get { return temperature; }
        }
        public string SpectralClass
        {
            get { return spectralClass; }
        }
        public double Luminosity
        {
            get { return luminosity; }
        }
        public double Age
        {
            get { return age; }
        }
        public double Life
        {
            get { return life; }
        }
        public double OrbitRadius
        {
            get { return orbitRadius; }
        }
        public double Eccentricity
        {
            get { return eccentricity; }
        }
        public double DustMass
        {
            get { return massDust; }
        }
        public double GasMass
        {
            get { return massGas; }
        }
        public bool Fragmented
        {
            get { return fragmented; }
        }
        public double Density
        {
            get { return density; }
        }
        public double SurfaceGravity
        {
            get { return surfaceGravity; }
        }
        public double EscapeVelocity
        {
            get { return escapeVelocity; }
        }
        public double OrbitPeriod
        {
            get { return orbitPeriod; }
        }
        public double RotationRate
        {
            get { return rotationRate; }
        }
        public bool Locked
        {
            get { return locked; }
        }
        public double Pressure
        {
            get
            {
                return pressure;
            }
        }
        public double Radius
        {
            get { return radius; }
        }
        public double Mass
        {
            get { return mass; }
        }

        internal Celestial(DbDataRow dr)
            : base(dr.Database, EveObjectType.Celestial, dr["celestialID"])
        {
            Fill(dr);
        }
        internal Celestial(Database db, int id)
            : base(db, EveObjectType.Celestial, id)
        {
            Fill(db.ExecuteSingle("SELECT * FROM mapCelestialStatistics WHERE celestialID=" + id));
        }
        private void Fill(DbDataRow dr)
        {
            temperature = dr["temperature"];
            spectralClass = dr["spectralClass"];
            luminosity = dr["luminosity"];
            age = dr["age"];
            life = dr["life"];
            orbitRadius = dr["orbitRadius"];
            eccentricity = dr["eccentricity"];
            massDust = dr["massDust"];
            massGas = dr["massGas"];
            fragmented = dr["fragmented"];
            density = dr["density"];
            surfaceGravity = dr["surfaceGravity"];
            escapeVelocity = dr["escapeVelocity"];
            orbitPeriod = dr["orbitPeriod"];
            rotationRate = dr["rotationRate"];
            locked = dr["locked"];
            pressure = dr["pressure"];
            radius = dr["radius"];
            mass = dr["mass"];
        }
    }
}
